//using SqlSugar;
//using IM.Easy.Core.Services;
//using IM.Easy.Core.Utils;
//using IM.Easy.Infrastructure.Query;
//using IM.Easy.Core.Extensions;
//using IM.Easy.Entity.System;
//using IM.Easy.Workflow.IServices;
//using IM.Easy.Entity.Workflow;
//using IM.Easy.Workflow.Dtos;
//using Mapster;
//using WorkflowCore.Interface;
//using IM.Easy.Core.AppContext;

//namespace IM.Easy.SystemServices.Services
//{
//    public class WorkflowTaskService : AppServices<WorkflowTask>, IWorkflowTaskService
//    {
//        private readonly IWorkflowHost _workflowHost;

//        public WorkflowTaskService(ISqlSugarClient db, IWorkflowHost workflowHost) : base(db)
//        {
//            _workflowHost = workflowHost;
//        }

//        public async Task<WorkflowTask> Create(WorkflowTaskCreateDto createDto)
//        {
//            var task = new WorkflowTask();
//            task = createDto.Adapt(task);
//            var wfid = await _workflowHost.StartWorkflow("demo");
//            task.WorkflowId = wfid;
//            task.InitiatorUserId = ImApp.User.Id;
//            task.Status = Entity.Workflow.TaskStatus.Pending;
//            Insert(task);
//            return task;
//        }

//        public WorkflowTask GetById(Guid id)
//        {
//            // TODO: 添加获取逻辑
//            return Context.Queryable<WorkflowTask>().InSingle(id);
//        }

//        public PageResponse<WorkflowTask> GetPageList(WorkflowTaskQueryDto query)
//        {
//            var queryable = Context.Queryable<WorkflowTask>();
//            var exp = Expressionable.Create<WorkflowTask>();
//            exp = exp
//;
//            var page = queryable
//                 .Where(exp.ToExpression())
//                 .ToPageList<WorkflowTask, WorkflowTask>(query);
//            return page;
//        }

//        public bool Update(WorkflowTask entity)
//        {
//            // TODO: 添加更新逻辑
//            return Context.Updateable(entity).ExecuteCommandHasChange();
//        }

//        public bool Delete(params Guid[] Id)
//        {
//            // TODO: 添加删除逻辑
//            return Context.Deleteable<WorkflowTask>(Id).ExecuteCommandHasChange();
//        }
//    }
//}
